#pragma once
#include "cef/cef_module/cef_control/cef_control.h"
#include "cef/cef_module/js_bridge/cef_js_bridge.h"
#include "module/cef/cef_global_methods.h"

class CefChatGPT : public ui::Box
{
public:
	CefChatGPT();

	static ui::Control* CreateControl(const std::wstring& pstrClass);
	virtual void DoInit() override;

private:
	bool OnClicked(ui::EventArgs* arg);
	bool OnMenuCommand(CefRefPtr<CefContextMenuParams> params, int command_id, CefContextMenuHandler::EventFlags event_flags);
	bool OnLinkClick(const std::wstring& url);
	CefRequestHandler::ReturnValue OnBeforeNavigate(CefRefPtr<CefRequest> request, bool is_redirect);
	void OnLoadingStateChange(bool isLoading, bool canGoBack, bool canGoForward);
	void OnLoadEnd(int httpStatusCode);
	void OnLoadError(CefLoadHandler::ErrorCode errorCode, const CefString& errorText, const CefString& failedUrl);
	void OnAfterCreated(CefRefPtr<CefBrowser> browser);
	void OnBeforeClose(CefRefPtr<CefBrowser> browser);
	void OnBeforeContextMenu(CefRefPtr<CefContextMenuParams> params, CefRefPtr<CefMenuModel> model);

private:
	ui::CefControl* cef_control_;
};